<%@ page import="cn.kgc.javaweb.entity.User" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.HashMap" %><%--
  Created by IntelliJ IDEA.
  User: mengshun
  Date: 2022/3/18
  Time: 16:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>El取值 复杂类型</title>
</head>
<body>
<%--
        数组   集合  map  对象

--%>

    <%
        User user = new User();
        user.setAge(20);
        user.setUserName("lisi");
        String[] str = {"看书","音乐"};
        List<Integer> list = Arrays.asList(1, 2);
        HashMap<String, Integer> map = new HashMap<>();
        map.put("语文",20);
        map.put("english",70);
        user.setHobby(str);
        user.setList(list);
        user.setScore(map);

        session.setAttribute("user",user);
    %>
</body>
<%--EL表达式取出对象中的值--%>

<h1>基本类型值得取出age ${user.age}</h1>
<h1>数组类型值得取出hobby ${user.hobby[0]}</h1>
<h1>list集合类型值得取出list${user.list.get(0)}</h1>
<h1>map集合类型值得取出score${user.score.english}</h1>
<h1>map集合类型值得取出score${user.score["语文"]}</h1>
<%--使用El表达式取出cookie中的值--%>
<h1>${cookie.username.value}</h1>
</html>
